/**
 * Created by vijanny on 2017-03-01.
 */
'use strict'



var Koa = require('koa');
var options = require('./options.json');


var logger = require('koa-logger');
//const convert = require('koa-convert');


var bodyParser = require('koa-bodyparser');

var app = new Koa();


var Router = require('koa-router');

var router = new Router();
var serve = require('koa-static');

app.use(logger());

app.use(bodyParser());

var act = require('./actions');

router.post('/order',act.order);
router.post('/order/reset',act.reset);
router.post('/dev/status/:time',act.status);
router.post('/dev/status/info',act.info);
router.post('/IHController',act.IHController);
router.get('/RHoot/status',act.getRHootStatus);
router.post('/RHootController',act.RHootController);

app.use(serve(__dirname + '/public'));
//router.post('/order',act.order);
//
app
    .use(router.routes())
    .use(router.allowedMethods());

app.listen(options.port);
console.log('Listening: ' + options.port);
